//
//  LSPersonalInfoIconImageViewCell.m
//  LaSaCivilAffairsDepartment
//
//  Created by 聂志康 on 2018/12/20.
//  Copyright © 2018 wpkj. All rights reserved.
//

#import "LSPersonalInfoIconImageViewCell.h"

@interface LSPersonalInfoIconImageViewCell ()
@property (nonatomic, strong) UILabel *mainTitleLabel;
@property (nonatomic, strong) UIImageView *rightArrowImageView;
@end

@implementation LSPersonalInfoIconImageViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self.contentView addSubview:self.iconImageView];
        [self.contentView addSubview:self.mainTitleLabel];
        [self.contentView addSubview:self.rightArrowImageView];
    }
    return self;
}

- (void)setMainTitle:(NSString *)mainTitle {
    _mainTitle = mainTitle;
    self.mainTitleLabel.text = mainTitle;
}

- (void)setIconImageName:(NSString *)iconImageName {
    _iconImageName = iconImageName;
    self.iconImageView.image = [UIImage imageNamed:iconImageName];
}

- (UIImageView *)iconImageView {
    if (!_iconImageView) {
        _iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(ScreenWidth-30-34, (LSPersonalInfoIconImageViewCellHeight-34)/2, 34, 34)];
        _iconImageView.layer.cornerRadius = 34/2;
        _iconImageView.layer.masksToBounds = true;
    }
    return _iconImageView;
}

- (UILabel *)mainTitleLabel {
    if (!_mainTitleLabel) {
        _mainTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 0, 100, LSPersonalInfoIconImageViewCellHeight)];
        _mainTitleLabel.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:11];
        _mainTitleLabel.textColor = hexColor(333333);
    }
    return _mainTitleLabel;
}

- (UIImageView *)rightArrowImageView {
    if (!_rightArrowImageView) {
        _rightArrowImageView = [[UIImageView alloc] initWithImage:[[UIImage imageNamed:@"jiantou"] changeWithNewTintColor:hexColor(999999)]];
        _rightArrowImageView.center = CGPointMake(ScreenWidth-20, LSPersonalInfoIconImageViewCellHeight/2);
    }
    return _rightArrowImageView;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
